﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Circa.Tools {
    public class AutoSafeObjectDictionary<TKey, TValue>: SafeDictionary<TKey, TValue> where TValue: new( ) {
        public new TValue this[ TKey key ] {
            get {
                TValue value;

                if ( !TryGetValue( key, out value ) ) {
                    value = new TValue( );
                    base[ key ] = value;
                }
                return value;
            }
            set {
                base[ key ] = value;
            }
        }

    }

}
